TeX coding examples

For a complete listing of TeX codes, see the TeX cookbook. If you use the cookbook, be aware of the following:

For this symbol or notation . . . Code TeX this way...
Percent symbol (%)

<tex>\%</tex>

Subtraction sign (–) <tex>-</tex>
Multiplication

\cdot or \times

Use \cdot for multiplication between variables

For example:

w = Fd is F \cdot d

If explicit multiplication needs to be emphasized. Do not use \times.

Use × (\times in TeX) for scientific notation, dimensional analysis, and equations involving words.

Regular space ~ or \;
Lowercase Greek letter

\lower_Greek_letter

For example:

\alpha

Uppercase Greek letter

\upper_Greek_letter

For example:

\Alpha

{x \over y}

-OR-

{\frac {x}{y}} 

Roman font

\rm

To combine several fonts, use {\rm text} to specify Roman

Italic font

\it

To combine several fonts, use {\it text} to specify italics

Vector arrow over xy

\vec {xy}

Chemistry reaction arrow

\rightarrow

Chemistry equilibrium arrow

\rightleftharpoons

Infinity symbol

\infty
Centered ellipses (math mode) \cdots
Units of measure

Make sure there is a space between the number and the unit

28 m/s2 is 28 <tex>{\rm m/s^2}</tex>

15 g is <tex>{\rm g}</tex>

G is <tex>{\rm G}</tex>

Math equations

Use \matrix to set multiple line equations.

Here is an example:

 

The code for this is:

\matrix{\hfill P_{\rm He} & = & P_{\rm total} - P_{\rm N_2} - P_{\rm O_2} \hfill \cr \hfill & = & 1.00 \; {\rm atm} - 0.70 \; {\rm atm} - 0.25 \; {\rm atm} \hfill \cr \hfill & = & 0.05 \; {\rm atm}\hfill \cr}

Chemical equations

The use of end punctuation will depend on context. In general it is not used.

All display chemical equations should be in its own paragraph with <p @align = center>

Set multi-line equations in TeX with the \matrix environment.

Do not use a table in which every cell is occupied with a separate term or operator.

Here is an example:

The code for this is:

{\matrix{\hfill {\rm C_6H_{12}O_6(s) }& \rightleftharpoons & {\rm 6CO_2(g) + 6H_2O(l)} \hfill \cr \hfill {\rm C_6H_{12}O_6(s)} & \rightleftharpoons & {\rm 6C_2H_5O_H(l) + 2CO_2(g)}\hfill \cr}}

 

Elements and other chemical symbols

This includes single elements such as H, Ne, etc.

For example, He would be <tex> {\rm He} </tex>

 

Note: You can also use ^\circ for degrees.